use Image(OUString) instead of Image(Bitmap(OUString))
which benefits LOOL since we can delay creating the image until
we know the dpi setting of the display we are going to write to.
Change-Id: I4c16fd221f7ec3693e37bacf3fdf7026a8c2e8bc
Reviewed-on: https://gerrit.libreoffice.org/66574
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 9612b81..26a6e4f 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -89,33 +89,22 @@
{
mbGrabFocus = true;
// insert pages
std::vector<Image> imgVector;
OUString aStrTitle;
SvxIconChoiceCtrlEntry *pEntry;
imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLINETTP);
imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLMAILTP);
imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLDOCTP);
imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLDOCNTP);
for(Image &aImage : imgVector )
{
BitmapEx aBitmap = aImage.GetBitmapEx();
aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality);
aImage = Image(aBitmap);
}
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP );
pEntry = AddTabPage ( HyperLinkPageType::Internet, aStrTitle, imgVector[0], SvxHyperlinkInternetTp::Create );
pEntry = AddTabPage ( HyperLinkPageType::Internet, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLINETTP), SvxHyperlinkInternetTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP );
pEntry = AddTabPage ( HyperLinkPageType::Mail, aStrTitle, imgVector[1], SvxHyperlinkMailTp::Create );
pEntry = AddTabPage ( HyperLinkPageType::Mail, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLMAILTP), SvxHyperlinkMailTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
if (!comphelper::LibreOfficeKit::isActive())
{
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP );
pEntry = AddTabPage ( HyperLinkPageType::Document, aStrTitle, imgVector[2], SvxHyperlinkDocTp::Create );
pEntry = AddTabPage ( HyperLinkPageType::Document, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLDOCTP), SvxHyperlinkDocTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP );
pEntry = AddTabPage ( HyperLinkPageType::NewDocument, aStrTitle, imgVector[3], SvxHyperlinkNewDocTp::Create );
pEntry = AddTabPage ( HyperLinkPageType::NewDocument, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLDOCNTP), SvxHyperlinkNewDocTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
}
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 96a2fca..4246bfe 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -111,9 +111,7 @@
get(m_pCbbPath, "path");
m_pCbbPath->SetSmartProtocol(INetProtocol::File);
get(m_pBtCreate, "create");
BitmapEx aBitmap(RID_SVXBMP_NEWDOC);
aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
m_pBtCreate->SetModeImage(Image(aBitmap));
m_pBtCreate->SetModeImage(Image(RID_SVXBMP_NEWDOC));
get(m_pLbDocTypes, "types");
m_pLbDocTypes->set_height_request(m_pLbDocTypes->GetTextHeight() * 5);
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 9c3033b..968c420 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -42,15 +42,11 @@
get(m_pCbbPath, "path");
m_pCbbPath->SetSmartProtocol(INetProtocol::File);
get(m_pBtFileopen, "fileopen");
BitmapEx aBitmap(RID_SVXBMP_FILEOPEN);
aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality);
m_pBtFileopen->SetModeImage(Image(aBitmap));
m_pBtFileopen->SetModeImage(Image(RID_SVXBMP_FILEOPEN));
get(m_pEdTarget, "target");
get(m_pFtFullURL, "url");
get(m_pBtBrowse, "browse");
aBitmap = BitmapEx(RID_SVXBMP_TARGET);
aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
m_pBtBrowse->SetModeImage(Image(aBitmap));
m_pBtBrowse->SetModeImage(Image(RID_SVXBMP_TARGET));
// Disable display of bitmap names.
m_pBtBrowse->EnableTextDisplay (false);
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index f3f9cbc..b56f34f 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -42,9 +42,7 @@
get(m_pCbbReceiver, "receiver");
m_pCbbReceiver->SetSmartProtocol(INetProtocol::Mailto);
get(m_pBtAdrBook, "adressbook");
BitmapEx aBitmap(RID_SVXBMP_ADRESSBOOK);
aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
m_pBtAdrBook->SetModeImage(Image(aBitmap));
m_pBtAdrBook->SetModeImage(Image(RID_SVXBMP_ADRESSBOOK));
get(m_pFtSubject, "subject_label");
get(m_pEdSubject, "subject");
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 38402c8..0becb6f 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -176,9 +176,7 @@
get(mpEdIndication, "indication");
get(mpEdText, "name");
get(mpBtScript, "script");
BitmapEx aBitmap(RID_SVXBMP_SCRIPT);
aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
mpBtScript->SetModeImage(Image(aBitmap));
mpBtScript->SetModeImage(Image(RID_SVXBMP_SCRIPT));
mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) );
mpBtScript->EnableTextDisplay (false);
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 009048d..a57db4d 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -102,8 +102,8 @@
private:
SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs);
std::vector<BitmapEx> m_aShadowImgVec;
std::vector<BitmapEx> m_aBorderImgVec;
std::vector<Image> m_aShadowImgVec;
std::vector<Image> m_aBorderImgVec;
long nMinValue; ///< minimum distance
SwBorderModes nSWMode; ///< table, textframe, paragraph
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 57e23b0..0b230fc 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -596,24 +596,17 @@
// remember selection - is deleted in call to ValueSet::Clear()
sal_uInt16 nSel = m_aVsRefEdge.GetSelectedItemId();
BitmapEx aBottomLock(RID_SVXBMP_BOTTOMLOCK);
BitmapEx aTopLock(RID_SVXBMP_TOPLOCK);
BitmapEx aCellLock(RID_SVXBMP_CELLLOCK);
if( GetDPIScaleFactor() > 1 )
{
aBottomLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
aTopLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
aCellLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
}
Image aBottomLock(RID_SVXBMP_BOTTOMLOCK);
Image aTopLock(RID_SVXBMP_TOPLOCK);
Image aCellLock(RID_SVXBMP_CELLLOCK);
m_aVsRefEdge.Clear();
m_aVsRefEdge.SetStyle(m_aVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER);
m_aVsRefEdge.SetColCount(3);
m_aVsRefEdge.InsertItem(IID_BOTTOMLOCK, Image(aBottomLock), m_xFtBotLock->get_label());
m_aVsRefEdge.InsertItem(IID_TOPLOCK, Image(aTopLock), m_xFtTopLock->get_label());
m_aVsRefEdge.InsertItem(IID_CELLLOCK, Image(aCellLock), m_xFtCelLock->get_label());
m_aVsRefEdge.InsertItem(IID_BOTTOMLOCK, aBottomLock, m_xFtBotLock->get_label());
m_aVsRefEdge.InsertItem(IID_TOPLOCK, aTopLock, m_xFtTopLock->get_label());
m_aVsRefEdge.InsertItem(IID_CELLLOCK, aCellLock, m_xFtCelLock->get_label());
m_aVsRefEdge.SetOptimalSize();
m_aVsRefEdge.SelectItem( nSel );
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 749505c..aa48782 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -309,15 +309,6 @@
m_aShadowImgVec.emplace_back(pnShadowImgIds[i]);
assert(m_aShadowImgVec.size() == SVX_BORDER_SHADOW_COUNT);
if ( GetDPIScaleFactor() > 1 )
{
for (size_t i = 0; i < m_aBorderImgVec.size(); ++i)
m_aBorderImgVec[i].Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
for (size_t i = 0; i < m_aShadowImgVec.size(); ++i)
m_aShadowImgVec[i].Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
}
// this page needs ExchangeSupport
SetExchangeSupport();
@@ -1226,7 +1217,7 @@
for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
{
m_xWndPresets->InsertItem( nVSIdx );
m_xWndPresets->SetItemImage(nVSIdx, Image(m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]));
m_xWndPresets->SetItemImage(nVSIdx, m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]);
m_xWndPresets->SetItemText( nVSIdx, CuiResId( GetPresetStringId( nVSIdx ) ) );
}
@@ -1250,7 +1241,7 @@
for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx )
{
m_xWndShadows->InsertItem( nVSIdx );
m_xWndShadows->SetItemImage(nVSIdx, Image(m_aShadowImgVec[nVSIdx-1]));
m_xWndShadows->SetItemImage(nVSIdx, m_aShadowImgVec[nVSIdx-1]);
m_xWndShadows->SetItemText( nVSIdx, CuiResId( pnStrIds[ nVSIdx - 1 ] ) );
}
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 72aa34c..337fad9 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1098,15 +1098,12 @@
float fScaleFactor = GetDPIScaleFactor();
BitmapEx aSingleSelectBmp(RID_BMP_SELECT_CURRENT);
if (fScaleFactor > 1)
aSingleSelectBmp.Scale(fScaleFactor, fScaleFactor, BmpScaleFlag::Fast);
Image aSingleSelect(aSingleSelectBmp);
;
getSectionPosSize(aPos, aSize, BTN_SINGLE_SELECT);
maBtnSelectSingle->SetPosSizePixel(aPos, aSize);
maBtnSelectSingle->SetQuickHelpText(ScResId(STR_BTN_SELECT_CURRENT));
maBtnSelectSingle->SetModeImage(aSingleSelect);
maBtnSelectSingle->SetModeImage(Image(RID_BMP_SELECT_CURRENT));
maBtnSelectSingle->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) );
maBtnSelectSingle->Show();
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 311d535..d4f7a59 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -1159,10 +1159,10 @@
OUString sImageName("sd/cmd/transition-" + pPreset->getSetId() + ".png");
BitmapEx aIcon( sImageName );
if ( aIcon.IsEmpty() ) // need a fallback
aIcon = BitmapEx( "sd/cmd/transition-none.png" );
sImageName = "sd/cmd/transition-none.png";
mpVS_TRANSITION_ICONS->InsertItem(
nPresetOffset + 1, Image( aIcon ), sLabel,
nPresetOffset + 1, Image( sImageName ), sLabel,
VALUESET_APPEND, /* show legend */ true );
m_aNumVariants[ pPreset->getSetId() ] = 1;
diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx
index 9f2dcc7..a70bdc8 100644
--- a/sd/source/ui/dlg/inspagob.cxx
+++ b/sd/source/ui/dlg/inspagob.cxx
@@ -82,9 +82,7 @@
}
else
{
BitmapEx aBmpText(BMP_DOC_TEXT);
//to-do, check if this is already transparent and remove intermedia bitmapex if it is
Image aImgText(BitmapEx(aBmpText.GetBitmap(), COL_WHITE));
Image aImgText(BMP_DOC_TEXT);
m_pLbTree->InsertEntry( rName, aImgText, aImgText );
}